const hre = require("hardhat");

async function main() {
  const router = process.env.ROUTER_ADDRESS;
  if(!router) { console.error("Set ROUTER_ADDRESS env var. Example: ROUTER_ADDRESS=0x... npx hardhat run scripts/check-router.js --network xlayerTestnet"); process.exit(1);}  
  const code = await hre.ethers.provider.getCode(router);
  console.log("Address:", router);
  console.log("Code length:", code.length);
  console.log(code === '0x' ? 'No contract deployed at this address' : 'Contract code present');
}

main().catch(e=>{console.error(e);process.exit(1);});
